import { createRouter, createWebHistory } from 'vue-router'

//导入组件
import Login from '@/views/Login.vue'
import backendVue from '@/views/backend/backend.vue'
import userVue from '@/views/user/user.vue'

import classify from '@/views/backend/pages/classify.vue'
import dishes from '@/views/backend/pages/dishes.vue'
import employee from '@/views/backend/pages/employee.vue'
import orders from '@/views/backend/pages/orders.vue'
import combination from '@/views/backend/pages/combination.vue'
import seats from '@/views/backend/pages/seats.vue'
import user from '@/views/backend/pages/user.vue'

import browse from '@/views/user/pages/browse.vue'
import personal from '@/views/user/pages/personal.vue'
import Shopping from '@/views/user/pages/Shopping.vue'

//定义路由关系
const routes = [
    // 登录页面
    { path: '/', component: Login },
    // 后台系统页面
    {
        path: '/backend', component: backendVue,
        //子路由
        children: [
            { path: '/backend/classify', component: classify },
            { path: '/backend/dishes', component: dishes },
            { path: '/backend/employee', component: employee },
            { path: '/backend/orders', component: orders },
            { path: '/backend/combination', component: combination },
            { path: '/backend/seats', component: seats },
            { path: '/backend/user', component: user }
        ]
    },
    // 用户系统页面
    {
        path: '/user', component: userVue,
        //子路由
        children: [
            { path: '/user/browse', component: browse },
            { path: '/user/personal', component: personal },
            { path: '/user/Shopping', component: Shopping },
        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router
